
const axis = {
  type: 'category',
  splitLine: { show: true },
  axisLabel: {
    interval: 0,
    showMaxLabel: false,
    showMinLabel: false
  },
  boundaryGap: false, // 关闭分类轴左右两边留白策略
  axisTick: {
    alignWithLabel: true // 使刻度线与标签对齐
  },
}
export function getChartsOptions(title: string, xAxis: string[], yAxis: string[], series: any[]) {
  return {
    grid: {
      containLabel: true,
      left: '10'
    },
    title: {
      text: title,
      left: '10',
    },
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b} : {c} ',
    },
    legend: {
      orient: 'vertical',
      left: '10',
      bottom: '0%',
      data: series.map(it => it.name),
    },
    xAxis: {
      ...axis,
      data: xAxis
    },
    yAxis: {
      ...axis,
      data: yAxis
    },
    series
  }
}